package pt.isel.lercm.projectmanager.spring.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import pt.isel.lercm.projectmanager.spring.dao.EmailTemplateDAO;
import pt.isel.lercm.projectmanager.spring.model.EmailTemplate;

@Service("EmailTemplateService")
@Transactional(readOnly = true)
public class EmailTemplateService implements IEmailTemplateService {

	@Autowired
	EmailTemplateDAO emailTemplateDao;

	public EmailTemplateDAO getEmailTemplateDao() {
		return emailTemplateDao;
	}

	public void setEmailTemplateDao(EmailTemplateDAO emailTemplateDao) {
		this.emailTemplateDao = emailTemplateDao;
	}
		
	@Transactional(readOnly = false)
	@Override
	public void add(EmailTemplate aluno){
		getEmailTemplateDao().addObject(aluno);
	}
	
	@Transactional(readOnly = false)
	@Override
	public void update(EmailTemplate aluno){
		getEmailTemplateDao().updateObject(aluno);
	}
	
	@Transactional(readOnly = false)
	@Override
	public void delete(EmailTemplate aluno){
		getEmailTemplateDao().deleteObject(aluno);
	}
	
	@Override
	public EmailTemplate getById(int id){
		return getEmailTemplateDao().getByid(id);
	}
	
	@Override
	public List<EmailTemplate> getAll(){
		return getEmailTemplateDao().getAll();
	}
	
	public EmailTemplate getByTitulo(String titulo){
		return getEmailTemplateDao().getByTitulo(titulo);
	}
}
